package com.example.baiapiinterface.controller;
import com.zimu.common.model.entity.User;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;


@RestController
@RequestMapping("/name")
public class BasicController {
    @GetMapping()
    public String getNameByGet(@RequestParam("name") String name) {
        return String.format("GET 名字是%s",name) ;
    }
    @PostMapping()
    public String getNameByPost(@RequestParam String name) {
        return String.format("POST PARAMS 名字是%s",name) ;
    }

    // http://127.0.0.1:8080/save_user?name=newName&age=11
    @PostMapping("/user")
    public String getUserByPostUser(@RequestBody User user, HttpServletRequest request) {
        return "POST user : name=" + user.getUserName();
    }
}
